package com.e3.sysmg.security.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.e3.web.core.model.SuperQC;

public class UserQC extends SuperQC {

	private static final long serialVersionUID = -4799032550183795020L;

	private String code;
	
	private String name;
	
	private Date startDate;
	
	private Date endDate;
	
	private String status;
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Date getStartDate() {
		return startDate;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Override
	public List<String> getWhereList() {
		List<String> fields = new ArrayList<String>();
		if(getCode() != null){
			String code = getCode().trim();
			if(code.length()>0){
				fields.add(getStringStatement("code",code));
			}	
		}
		
		if(getName() != null){
			String name = getName().trim();
			if(name.length()>0){
				fields.add(getStringStatement("name", name));
			}	
		}
		
		if(getStartDate()!=null){
			Date date = getStartDate();
			fields.add(getGreaterEqStatement("startDate", date.getTime()));
		}
		
		if(getEndDate()!=null){
			Date date = getEndDate();
			fields.add(getLesserEqStatement("endDate", date.getTime()));
		}
		
		if(getStatus()!=null){
			String strStatus = getStatus().trim();
			if(strStatus.length()>0){
				int status = Integer.parseInt(strStatus);
				fields.add(getNumEqualsStatement("status",status));
			}
		}
		return fields;
	}
}
